#include<stdio.h>
int main()
{
    int t, count, k;
    scanf("%d", &t);
    while( t-- )
    {
        scanf("%d", &k);
        count = 0;
        while( k / 2 * 2 == k )
        {
            count++;
            k /= 2;
        }
        printf("%d %d\n", k, count);
    }
    return 0;
}
